package com.inspur.jxpcxt.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.inspur.jxpcxt.bean.EvaInfo;
import com.inspur.jypcxt.R;

public class ShowStudentCommentAdapter extends BaseAdapter {
	private Context mContext = null;
	private LayoutInflater mLayoutInflater = null;
	List<EvaInfo> mData = new ArrayList<EvaInfo>();
	public ShowStudentCommentAdapter(Context context,List<EvaInfo> data) {
		super();
		mContext = context;
		mLayoutInflater = LayoutInflater.from(mContext);
		this.mData = data;
	}

	/**
	 * 包含项数
	 */
	@Override
	public int getCount()
		{
			// TODO Auto-generated method stub
			return mData.size();
		}

	@Override
	public Object getItem(int arg0)
		{
			// TODO Auto-generated method stub
			return null;
		}
	/**
	 * 列表项ID
	 */
	@Override
	public long getItemId(int position)
		{
			// TODO Auto-generated method stub
			return position;
		}
	/**
	 * 返回的列表框
	 */
	@Override
	public View getView(int position, View convertView, ViewGroup parent)
		{
			ViewHolder holder = null;
			if(convertView == null){
				convertView = mLayoutInflater.inflate(R.layout.item_teacher_comment, parent, false);
				holder = new ViewHolder();
				holder.mTnoTv = (TextView) convertView.findViewById(R.id.tv_comment_tno);
				holder.mTnameTv = (TextView) convertView.findViewById(R.id.tv_comment_tname);
				holder.mSnoTv = (TextView) convertView.findViewById(R.id.tv_comment_sno);
				holder.mCname = (TextView) convertView.findViewById(R.id.tv_comment_cname);
				holder.mAvgTv = (TextView) convertView.findViewById(R.id.tv_comment_avg);
				holder.mGradeTv = (TextView) convertView.findViewById(R.id.tv_comment_grade);
				convertView.setTag(holder);
			}else{
				holder = (ViewHolder) convertView.getTag();
			}
			//加载解析过来的数据
			holder.mTnoTv.setText("教师编号："+mData.get(position).getTno());
			//holder.mTnameTv.setText("教师姓名："+mData.get(position).getTname());
			holder.mSnoTv.setText("学生编号："+mData.get(position).getSno());
			holder.mCname.setText("课程名："+mData.get(position).getCname());
			//new DecimalFormat("##0.00").format(S),控制小数点后的位数
			//holder.mAvgTv.setText("分数："+ new DecimalFormat("##0.00").format(mData.get(position).getAverage()));
			//holder.mGradeTv.setText("等级："+mData.get(position).getGrade());
			return convertView;
		}
public class ViewHolder{
	TextView mTnoTv = null;
	TextView mTnameTv = null;
	TextView mSnoTv = null;
	TextView mCname = null;
	TextView mAvgTv = null;
	TextView mGradeTv = null;
		
	}

}
